//
//  WCNetworkAccessManager.h
//  WC
//
//  Created by 杨鑫 on 15/4/28.
//  Copyright (c) 2015年 智康. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "AFHTTPSessionManager.h"
#import "UIKit+AFNetworking.h"

typedef NS_ENUM(NSInteger, NetworkStatus) {
    NetworkStatusUnknow = -1,  //不知名网络
    NetworkStatusNO = 0,       //没有网络
    NetworkStatusWIFI = 1,     //WIFI网络
    NetworkStatus2G = 2,       //2G
    NetworkStatus3G = 3,       //3G
    NetworkStatus4G = 4        //4G
};

@interface WCNetworkAccessManager : NSObject

@property (strong, nonatomic) NSString *bathURL;
@property (nonatomic) NetworkStatus netStatus;

/**
 *  获取单例的方法
 *
 *  @return WCNetworkAccessManager
 */
+ (instancetype)sharedMg;



- (NSString *)getBaseUrl;

- (NSString *)getWexinAccessTokenApi;

/**
 *  上次这个请求访问的时间
 *
 *  @param url
 *
 *  @return NSTimeInterval
 */
- (NSTimeInterval)timeSinceLastUrl:(NSString *)url;

/**
 *  清空请求时间的记录
 */
- (void)resetTimeDic;

/**
 *  Get 请求
 *
 *  @param URLString  bathURL之后的部分
 *  @param parameters data
 *  @param success    返回结果成功
 *  @param failure    返回结果失败
 *  @param netError   网络错误
 *  @param always     always
 *
 *  @return AFHTTPRequestOperation
 */
- (NSURLSessionDataTask *)GET:(NSString *)URLString
                     parameters:(id)parameters
                        success:(void (^)(id responseObject))success
                        failure:(void (^)(NSString *msg))failure
                       netError:(void (^)(id error))netError
                         always:(void (^)(void)) always;

/**
 *  Post 请求
 *
 *  @param URLString  bathURL之后的部分
 *  @param parameters data
 *  @param success    返回结果成功
 *  @param failure    返回结果失败
 *  @param netError   网络错误
 *  @param always     always
 *
 *  @return AFHTTPRequestOperation
 */
- (NSURLSessionDataTask *)POST:(NSString *)URLString
                      parameters:(id)parameters
                         success:(void (^)(id responseObject))success
                         failure:(void (^)(NSString *msg))failure
                        netError:(void (^)(id error))netError
                          always:(void (^)(void)) always;

@end
